---
title: Snowflake
sidebar_position: 1
---

# Sequelize for Snowflake

:::danger

Our implementation of Snowflake is not integration tested against an actual database.
As such, we cannot guarantee that it will work as expected, nor its stability.

We rely on the community to help us improve this dialect.

:::

:::info Version Compatibility

See [Releases](/releases#snowflake-support-table) to see which versions of Snowflake are supported.

:::

To use Sequelize with Snowflake, you need to install the `@sequelize/snowflake` dialect package:

```bash npm2yarn
npm i @sequelize/snowflake
```

Then use the `SnowflakeDialect` class as the dialect option in the Sequelize constructor:

```ts
import { Sequelize } from '@sequelize/core';
import { SnowflakeDialect } from '@sequelize/snowflake';

const sequelize = new Sequelize({
  dialect: SnowflakeDialect,
  accessUrl: 'https://myaccount.us-east-1.snowflakecomputing.com',
  role: 'myRole',
  warehouse: 'myWarehouse',
  username: 'myUserName',
  password: 'myPassword',
  database: 'myDatabaseName',
});
```

## Connection Options

import ConnectionOptions from './_connection-options.md';

<ConnectionOptions />

The following options are passed as-is to the `snowflake-sdk` package that Sequelize uses to connect to Snowflake.
Please refer to the [Snowflake documentation](https://docs.snowflake.com/en/developer-guide/node-js/nodejs-driver-options) for more information about what each of these options do.

For convenience, here is an edited copy of the documentation that only includes the options that are accepted by Sequelize:

| Option                                     | Description                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accessUrl`                                | Specifies a fully-qualified endpoint for connecting to Snowflake.                                                                                                                                                                                                                                                                                                                                                                     |
| `account`                                  | Snowflake Account Identifier                                                                                                                                                                                                                                                                                                                                                                                                          |
| `application`                              | Specifies the name of the client application connecting to Snowflake.                                                                                                                                                                                                                                                                                                                                                                 |
| `authenticator`                            | Specifies the authenticator to use for verifying user login credentials. See the [Snowflake documentation](https://docs.snowflake.com/en/developer-guide/node-js/nodejs-driver-options#authentication-options) for details                                                                                                                                                                                                            |
| `clientSessionKeepAlive`                   | By default, client connections typically time out approximately 3-4 hours after the most recent query was executed.<br/>If the `clientSessionKeepAlive` option is set to `true`, the client’s connection to the server will be kept alive indefinitely, even if no queries are executed.<br/>Note that [the Sequelize Pool](../other-topics/connection-pool.md) also disconnects connections if they are idle after a specified time. |
| `clientSessionKeepAliveHeartbeatFrequency` | Sets the frequency (interval in seconds) between heartbeat messages.                                                                                                                                                                                                                                                                                                                                                                  |
| `database`                                 | The default database to use for the session after connecting.                                                                                                                                                                                                                                                                                                                                                                         |
| `password`                                 | Password for the user for when `authenticator` is set to `SNOWFLAKE`.                                                                                                                                                                                                                                                                                                                                                                 |
| `privateKey`                               | Specifies the private key (in PEM format) for key pair authentication.                                                                                                                                                                                                                                                                                                                                                                |
| `privateKeyPass`                           | Specifies the passcode to decrypt the private key file, if the file is encrypted.                                                                                                                                                                                                                                                                                                                                                     |
| `privateKeyPath`                           | Specifies the local path to the private key file (e.g. `rsa_key.p8`).                                                                                                                                                                                                                                                                                                                                                                 |
| `role`                                     | The default security role to use for the session after connecting.                                                                                                                                                                                                                                                                                                                                                                    |
| `timeout`                                  | Number of milliseconds to keep the connection alive with no response. Default: 60000 (1 minute).                                                                                                                                                                                                                                                                                                                                      |
| `token`                                    | Specifies the OAuth token to use for authentication for when `authenticator` is set to `OAUTH`.                                                                                                                                                                                                                                                                                                                                       |
| `username`                                 | The login name for your Snowflake user or your Identity Provider.                                                                                                                                                                                                                                                                                                                                                                     |
| `warehouse`                                | The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.                                                                                                                                                                                                                                                                                                                |

## Other Snowflake Options

The following options are also available for Snowflake:

| Option         | Description                                                                                                              |
| -------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `showWarnings` | If `true`, warnings produced during the execution of a query will be sent to the `logging` callback. Default is `false`. |
